package GameLife;


public class Coord implements Comparable<Object> {
	int posX;
	int posY;
	int etat=2;
	boolean traite=false;

	public Coord() {
		posX = posY = 0;
		
	}

	public Coord(int x, int y) {
		posX = x;
		posY = y;
		
	}
	public Coord(int x, int y, int e) {
		posX = x;
		posY = y;
		etat=e;
	}

	public Coord(int x, int y, boolean e) {
		posX = x;
		posY = y;
		traite=e;
	}
	@Override
	public int compareTo(Object arg0) {
		if (arg0 instanceof Coord) {
			if (((Coord) arg0).posX == this.posX
					&& ((Coord) arg0).posY == this.posY) {
				return 0;
			} else if (((Coord) arg0).posY > this.posY) {
				return -1;
			} else if (((Coord) arg0).posY == this.posY) {
				if (((Coord) arg0).posX > this.posX) {
					return 1;
				} else {
					return -1;
				}
			} else {
				return 1;
			}
		}
		return -1;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + posX;
		result = prime * result + posY;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Coord other = (Coord) obj;
		if (posX != other.posX)
			return false;
		if (posY != other.posY)
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Coord [posX=" + posX + ", posY=" + posY + "]";
	}

}
